import path from "path";
import {
	defineConfig
} from 'vite'
import vue from '@vitejs/plugin-vue'
import conf from '../sys-config'

// https://vitejs.dev/config/
export default defineConfig({
	base: './',
	resolve: {
		alias: {
			// 配置资源路径
			"@/": `${path.resolve(__dirname, "src")}/`,
		},
	},
	css: {
		preprocessorOptions: {
			scss: {
				// 自定义的主题色
				additionalData: `@use "@/styles/element/index.scss" as *;`,
			},
		},
	},
	// 打包配置
	build: {
		target: 'modules',
		outDir: 'dist', //指定输出路径
		assetsDir: 'assets', // 指定生成静态资源的存放路径
		minify: 'terser' // 混淆器，terser构建后文件体积更小
	},
	server: {
		entry: 'index.html',
		port: conf.frontend.host,
		// open: true,
		proxy: { // 代理配置
			'/api': `http://localhost:${conf.app.host}/`
		},
	},
	plugins: [
		vue(),
	],
});
